<section class="content">
    <div class="row">
        <div class="col-md-12">
            <div class="box">
                <div class="box-header">

                    <h3 class="box-title"></h3>

                    <div class="pull-right">
                        <div class="btn-group pull-right" style="margin-right: 10px">
                            <a href="admin/record/1" class="btn btn-sm btn-primary"
                               data-toggle="modal" data-target="#filter-modal"><i class="fa fa-filter"></i>&nbsp;&nbsp;Filter</a>
                        </div>

                        <div class="modal fade" id="filter-modal" role="dialog" aria-labelledby="myModalLabel"
                             aria-hidden="true">
                            <div class="modal-dialog" role="document">
                                <div class="modal-content">
                                    <div class="modal-header">
                                        <button type="button" class="close" data-dismiss="modal"
                                                aria-label="Close">
                                            <span aria-hidden="true">×</span>
                                            <span class="sr-only">Close</span>
                                        </button>
                                        <h4 class="modal-title" id="myModalLabel">Filter</h4>
                                    </div>
                                    <form action="admin/record/1?_url=%2Fadmin%2Frecord%2F1&amp;_pjax=%23pjax-container"
                                          method="get" pjax-container="">
                                        <div class="modal-body">
                                            <div class="form">
                                                <div class="form-group">
                                                    <div class="form-group">
                                                        <label>ID</label>
                                                        <div class="input-group">
                                                            <div class="input-group-addon">
                                                                <i class="fa fa-pencil"></i>
                                                            </div>
                                                            <input type="text" class="form-control id"
                                                                   placeholder="ID" name="id" value="1">
                                                        </div>
                                                    </div>
                                                </div>
                                            </div>
                                        </div>
                                        <div class="modal-footer">
                                            <button type="submit" class="btn btn-primary submit">Submit</button>
                                            <button type="reset" class="btn btn-warning pull-left">Reset
                                            </button>
                                        </div>
                                    </form>
                                </div>
                            </div>
                        </div>
                    </div>

                    <span>
                        <div class="btn-group">
                            <div class="row pull-left" style="width: 390px">
                                <div class="col-lg-6">
                                    <div class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                        <input type="text" name="starttime" value="" class="form-control starttime"
                                               style="width: 160px">
                                    </div>
                                </div>
                                <div class="col-lg-6">
                                    <div class="input-group">
                                        <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                                        <input type="text" name="endtime" value="" class="form-control endtime"
                                               style="width: 160px">
                                    </div>
                                </div>
                            </div>
                            <button class="btn btn-sm btn-twitter pull-left screen" style="margin-left:50px;"><i
                                        class="fa fa-filter"></i> 筛选</button>
                        </div>
                        @if(isset($excelTime))
                            <div class="btn-group pull-right" style="margin-right: 10px">
                                <a target="_blank" href="/admin/excel/export?time={{$excelTime}}"
                                   class="btn btn-sm btn-twitter"><i class="fa fa-download"></i> Export</a>
                            </div>
                        @endif
                    </span>
                </div>
                <!-- /.box-header -->
                <div class="box-body table-responsive no-padding">
                    <table class="table table-hover">
                        <tbody>
                        <tr>
                            <th>日期</th>
                            <th>所属广告主</th>
                            <th>广告名称</th>
                            <th>
                                {{--曝光pv--}}
                            </th>
                            <th>曝光uv</th>
                            <th>
                                {{--曝光ip--}}
                            </th>
                            <th>
                                {{--点击pv--}}
                            </th>
                            <th>点击uv</th>
                            <th>
                                {{--点击ip--}}
                            </th>
                            <th>
                                点击率
                            </th>
                        </tr>
                        @foreach($analyzeList as $key => $val)
                            <tr style="background-color: #ccc;">
                                <td>
                                    {{$key}}
                                </td>
                                <td>
                                    监测pv：{{$val['monitorPv'] ?? 0}}
                                </td>
                                <td>
                                    监测uv：{{$val['monitorUv'] ?? 0}}
                                </td>
                                <td></td>
                                <td>
                                    页面PV:{{$val['pv']}}
                                </td>
                                <td>
                                    页面UV:{{$val['uv']}}
                                </td>
                                <td>
                                    页面IP:{{$val['ip']}}
                                </td>
                                <td></td>
                                <td></td>
                                <td></td>
                            </tr>
                            @foreach($val['advertiList'] as $k => $v)
                                <tr>
                                    <td></td>
                                    <td>{{$v['nickname']}}</td>
                                    <td>{{$v['name']}}</td>
                                    <td>
                                        {{--{{$v['number']}}--}}
                                    </td>
                                    <td>{{$v['numberUv']}}</td>
                                    <td>
                                        {{--{{$v['numberIp']}}--}}
                                    </td>
                                    <td>
                                        {{--{{$v['useNumber'] ?? '0'}}--}}
                                    </td>
                                    <td>{{$v['useNumberUv'] ?? '0'}}</td>
                                    <td>
                                        {{--{{$v['useNumberIp'] ?? '0'}}--}}
                                    </td>
                                    <td>
                                        {{$v['rate']}}
                                    </td>
                                </tr>
                            @endforeach
                            <tr style="background-color: #CCCCBC;">
                                <td></td>
                                <td></td>
                                <td>汇总</td>
                                <td>
                                    {{--{{$val['analyzeCount']['numberCount']}}--}}
                                </td>
                                <td>{{$val['analyzeCount']['numberUvCount']}}</td>
                                <td>
                                    {{--{{$val['analyzeCount']['numberIpCount']}}--}}
                                </td>
                                <td>
                                    {{--{{$val['analyzeCount']['useNumberCount']}}--}}
                                </td>
                                <td>{{$val['analyzeCount']['useNumberUvCount']}}</td>
                                <td>
                                    {{--{{$val['analyzeCount']['useNumberIpCount']}}--}}
                                </td>
                                <td>

                                </td>
                            </tr>
                        @endforeach
                        </tbody>
                    </table>
                </div>
            </div>
        </div>
    </div>

</section>
<script>
    $(function () {
        $('.day_budget').inputmask({"alias": "currency", "radixPoint": ".", "prefix": "", "removeMaskOnSubmit": true});

        $('.starttime').datetimepicker({"format": "YYYY-MM-DD HH:mm:ss", "locale": "en"});
        $('.endtime').datetimepicker({"format": "YYYY-MM-DD HH:mm:ss", "locale": "en", "useCurrent": false});
        $(".starttime").on("dp.change", function (e) {
            $('.endtime').data("DateTimePicker").minDate(e.date);
        });
        $(".endtime").on("dp.change", function (e) {
            $('.starttime').data("DateTimePicker").maxDate(e.date);
        });

        $('.screen').click(function () {
            startTime = $('.starttime').val()
            endTime = $('.endtime').val()

            if (!startTime) {
                alert('请选择开始时间')
                return false;
            }

            href = window.location.href

            i = href.indexOf('?')

            href = href.substr(0, i)

            location.href = href + '?startTime=' + startTime + '&endTime=' + endTime
        })
    })
</script>